/*
 * @Autor: dingxiaolin
 * @Date: 2021-04-09 10:39:32
 * @LastEditors: dingxiaolin
 * @LastEditTime: 2021-05-24 11:08:11
 */
import { createRouter, createWebHistory, RouteRecordRaw, createWebHashHistory } from 'vue-router'
import Login from '@/views/Login.vue'
const routes: Array<RouteRecordRaw> = [
    {
        path: '/login',
        name: 'Login',
        component: Login,
    },
    {
        path: '/bigScreen',
        name: 'BigScreen',
        component: () => import('@/views/BigScreen.vue'),
    },
    {
        path: '/xstable',
        name: 'xsTable',
        component: () => import('@/views/xsTable.vue'),
    },
    {
        path: '/xsTargetTable',
        name: 'xsTargetTable',
        component: () => import('@/views/xsTargetTable.vue'),
    },
    {
        path: '/fhTable',
        name: 'fhTable',
        component: () => import('@/views/fhTable.vue'),
    },
    {
        path: '/hkTable',
        name: 'hkTable',
        component: () => import('@/views/hkTable.vue'),
    },
    {
        path: '/kcTable',
        name: 'kcTable',
        component: () => import('@/views/kcTable.vue'),
    },

    { path: '/:catchAll(.*)', redirect: '/login' }   /*默认跳转路由*/
]
const router = createRouter({
    history: createWebHashHistory('/h5'),
    routes
})
router.beforeEach((to, from, next) => {
    //路由钩子改标题
    if (to.meta.title) document.title = to.meta.title as string;
    next();
});
/**
 * 路由错误回调
 */
router.onError((handler) => {
    console.log("error:", handler);
});
export default router
